const client = require("../../models/index.js")

class AdminController{
    // 查询所有用户
    static searchAll(request,response){
        client.query("select * from user_msg ",function(err,results){
            response.send({msg:"获取所有用户信息成功",data:results,code:200})
        })
    }
    // 查询注销用户
    static searchDelAll(request,response){
        client.query("select * from user_msg where isDelete='1'",function(err,results){
            response.send({msg:"获取注销用户信息成功",data:results,code:200})
        })
    }
    // 查询非注销用户
    static searchUseAll(request,response){
        client.query("select * from user_msg where isDelete='0'",function(err,results){
            response.send({msg:"获取非注销用户信息成功",data:results,code:200})
        })
    }
    // 查询所有用户
    static search(request,response){
        let {username} = request.query 
        client.query("select * from user_msg where username like  ? ",["%"+username+"%"],function(err,results){
            response.send({msg:"查询用户信息成功",data:results,code:200})
        })
    }
}

module.exports = AdminController;